from search.algorithm import Heuristic
from general import *
'''
Created on Apr 11, 2011

@author: bob
'''

    
class SqareDistances(Heuristic):
    '''
    classdocs
    '''


    def __init__(self):
        '''
        Constructor
        '''
    
    def evaluate(self, pState):
        robDistances, pileDistances = 0,0
        for r in pState.robots:
            robDistances += bestPileFromRobot(r, pState.dirt_locations)
        for p in pState.dirt_locations:
            pileDistances += bestRobotFromPile(p, pState.robots)
        return (len(pState.dirt_locations)**3)*(robDistances**2 + pileDistances**2)


class Manhattan(Heuristic):
    '''
    classdocs
    '''


    def __init__(self):
        '''
        Constructor
        '''
    def evaluate(self, pState):
        robDistances, pileDistances = 0,0
#        for r in pState.robots:
#            robDistances += bestPileFromRobot(r, pState.dirt_locations)
        for p in pState.dirt_locations:
            pileDistances += bestRobotFromPile(p, pState.robots)
#        return ('robDistances + 'pileDistances)
        return (pileDistances)
  